﻿Public Class Memory
    Private forcemen As Integer = "1024"
    Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As Boolean



    Public Sub Defrag(ByVal Max As Boolean)
        If Max = True Then
            forcemen = "2048"
        Else
            forcemen = "1024"
        End If
        Try
            '    Dim Mem As Process
            '  Mem = Process.GetCurrentProcess()
            SetProcessWorkingSetSize(forcemen, forcemen, forcemen)
        Catch ex As Exception

        End Try
    End Sub
End Class
